Skip to content

Auto-generate experimental warnings and usage docs for typekits from library metadata#9564

Open
Copilot wants to merge 25 commits intomainfrom
copilot/fix-http-typekits-documentation
Open

Auto-generate experimental warnings and usage docs for typekits from library metadata#9564
Copilot wants to merge 25 commits intomainfrom
copilot/fix-http-typekits-documentation

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

  • Modify tspd to detect @experimental tags in typekit interfaces
  • Auto-generate usage information from library metadata (package name)
  • Construct import paths generically from package name + experimental flag
  • Show experimental warning only when typekit is experimental
  • Show usage instructions for all typekits except compiler
  • Show registration import only for experimental non-compiler packages
  • Simplify logic by extracting conditional text to variables (improved readability)
  • Regenerate both HTTP and compiler typekit documentation
  • Merge latest main branch (March 9, 2026)
  • Fix formatting issues with pnpm format
  • Add changesets for @typespec/tspd and @typespec/http packages
  • Run pnpm format and pnpm cspell validation
Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: Http typekits are not exposed and documentation is missing info on how to use</issue_title>
<issue_description>### Describe the bug

I had to add

import "@typespec/http/experimental/typekit";

To make them work in a non Alloy environment. Otherwise typescript doesn't see merged typekit declaration and missing all http typekits.

This should be either documented or exposed and working with http module import.

Reproduction

import { getHttpOperation } from "@typespec/http";
import { $ } from "@typespec/compiler/typekit";
// import "@typespec/http/experimental/typekit"; // uncomment to make this work


const [httpOperation] = getHttpOperation(program, operation);
$(program).httpOperation.flattenResponses(httpOperation);

Checklist

<agent_instructions>Indicate in the documentation for http typekits how to import the typekits. Also ensure thatr the documentation indicates that the typekits are experimental and may have breaking changes without notice.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@markcowl @artsiommiksiuk The typekit for http is currently experimental, the API surface area is volatile, and it is not documented so that customers do not inadvertently take a dependency on it without understanding the risks. This is why it is both exported as experimental and undocumented.

If the ask is to get the API to move the API from experimental to part of the public exports, that is ongoing work, but we cna use this issue to track it, if you like</comment_new>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…mentation

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the meta:website TypeSpec.io updates label Feb 3, 2026
Copilot AI changed the title [WIP] Fix missing documentation for Http typekits Document HTTP typekits import and experimental status Feb 3, 2026
Copilot AI requested a review from markcowl February 3, 2026 00:03
@markcowl
Copy link
Contributor

@copilot please pull the latest from the main branch and fix any issues with website build

Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

@copilot please pull the latest from the main branch and fix any issues with website build

Done. I've successfully merged the latest main branch (commit aa2b623). The website build completes without errors, and all astro checks pass with 0 errors, 0 warnings, and 0 hints.

The HTTP typekits documentation now includes:

  • ✅ Experimental warning banner
  • ✅ Clear import instructions
  • ✅ Practical usage example

The documentation is fully compatible with the latest main branch changes.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js check --minimumFailingSeverity hint (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh s/.b�� ../../website/src/content/docs/d--output-dir dotnet p/bin/sh perimental gen-esh bash (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@markcowl
Copy link
Contributor

markcowl commented Mar 3, 2026

@copilot This problem cannot be solved by editing a static documentation web page, because the reference documentation is automatically generated from the source code using tspd which is a documentation generation package built in this repo. Please use any appropriate functionality in tspd to embed the new information into code comments in the typescript source for the http typekit, or add some functionality to tspd to allow you to add front matter for a typekit.

@markcowl
Copy link
Contributor

markcowl commented Mar 3, 2026

@copilot, also you need to merge in the latest changes from main. You should do this whenever you make an update to the code in your branch.

…umentation

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot This problem cannot be solved by editing a static documentation web page, because the reference documentation is automatically generated from the source code using tspd wh...

Done (commit 7b6e19e). I've modified tspd to automatically detect @experimental tags in typekit interfaces and generate experimental warnings and usage documentation.

Changes made:

  1. tspd enhancement: Added detection of @experimental JSDoc tags in typekit interfaces
  2. Auto-generated warnings: Experimental typekits now automatically include a caution banner
  3. Library-specific usage examples:
    • HTTP typekits show how to import @typespec/http/experimental/typekit
    • Compiler typekits show generic typekit usage patterns

The documentation is now auto-generated from source code comments, so future updates will automatically reflect changes to the experimental status and don't require manual documentation edits.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build api-extractor pec/�� ebsite/src/conte--llmstxt --verbose /.bin/node import @typespecnode bash tools/pnpm/10.23generate-scenarios-summary node tobu�� build.json gen-extern-signature /.bin/sh --no-emit sh tobuf/reference sh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@microsoft-github-policy-service microsoft-github-policy-service bot added the tspd Issues for the tspd tool label Mar 3, 2026
Copilot AI changed the title Document HTTP typekits import and experimental status Auto-generate experimental warnings and usage docs for HTTP typekits Mar 3, 2026
@markcowl
Copy link
Contributor

markcowl commented Mar 3, 2026

@copilot also you need to merge in the latest changes from main. You should do this whenever you make an update to the code in your branch.

Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot, also you need to merge in the latest changes from main. You should do this whenever you make an update to the code in your branch.

Done (commit 27e2db9). I've merged the latest changes from main branch into the PR branch. The merge completed successfully with 51 commits from main integrated.

Copy link
Contributor

@markcowl markcowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please pull the latest from main, fix the items in this review and ensure that all changed files are properly formatted using pnpm format

// Generate import statement based on package
let importStatement: string;
if (isHttpPackage && typekit.isExperimental) {
importStatement = `import "@typespec/http/experimental/typekit";`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this pattern is followed for experimental packages, I feel like we can construct this from the package name and the fact that it is experimental, without having specific if statements for specific packages embedded in the code.

Copilot AI and others added 2 commits March 5, 2026 00:37
…r typekits

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 5, 2026

@copilot please pull the latest from main, fix the items in this review and ensure that all changed files are properly formatted using pnpm format

Done (commit 843912c). I've addressed all review feedback:

  1. Removed package-specific if statements: Import path is now constructed generically as ${packageName}/experimental/typekit for experimental packages
  2. Skip usage for compiler: Compiler typekits now show only the experimental warning (no usage instructions since it's self-referential)
  3. Latest main merged: Successfully merged latest changes from main branch
  4. Regenerated all docs: Both HTTP and compiler typekit documentation regenerated
  5. Validation passed: Both pnpm format and pnpm cspell pass with no issues

Result:

  • HTTP typekits: Shows experimental warning + usage instructions with import "@typespec/http/experimental/typekit";
  • Compiler typekits: Shows only experimental warning (no import instructions)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh k/ty�� ebsite/src/conte--llmstxt dotnet .2_tmp_4070/node../../website/src/content/docs/docs/emitters/openapi3/reference --no-emit ture /.bin/sh node sion�� rs &amp;&amp; pnpm build:src tsconfig.build.json modules/.bin/sh ld.json &amp;&amp; pnpm node ps rsioning/referendoc node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from markcowl March 5, 2026 00:50
Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 5, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build -data-downloader. s/.b�� utput-dir ../../--llmstxt sh _modules/pnpm/dist/node-gyp-bin/node import @typespecnode sh s/.bin/sh node /nod�� es &amp;&amp; pnpm build:lib &amp;&amp; vite bui--typekits sh pec/node_modules/.bin/sh ld.json &amp;&amp; pnpm node l/reference .2_tmp_3958/nodedoc node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from markcowl March 5, 2026 21:35
Copy link
Contributor

@markcowl markcowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot You should be able to simplify the logic in typekits-file.tsx so that more of the usage text is shared between different kinds of typekits

…s and usage docs

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 5, 2026

@copilot You should be able to simplify the logic in typekits-file.tsx so that more of the usage text is shared between different kinds of typekits

Done (commit eeb575d). Refactored the logic to eliminate duplication:

  • Experimental Aside is now conditionally rendered only when typekit.isExperimental
  • Usage instructions are shared and shown for all packages (compiler and non-compiler) with conditional content
  • Registration import (import "${packageName}/experimental/typekit";) only shown for experimental non-compiler packages
  • The explanation about side effects only appears when the registration import is shown

The logic is now much simpler with less duplication between compiler and non-compiler cases.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh pec/�� utput-dir ../../--llmstxt sh pec/node_modules../../website/src/content/docs/docs/emitters/openapi3/reference pm run lint-typenode sh sh node pec/�� -p tsconfig.build.json .2_tmp_3923/node_modules/pnpm/dist/node-gyp-bin/sh . son st/node-gyp-bin/doc node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from markcowl March 5, 2026 21:57
@markcowl
Copy link
Contributor

markcowl commented Mar 9, 2026

@copilot Pull in the latest from main and fis the formatting of any changed files as needed (pnpm format)

Copy link
Contributor Author

Copilot AI commented Mar 9, 2026

@copilot Pull in the latest from main and fis the formatting of any changed files as needed (pnpm format)

Done (commit a1b68fe). Merged the latest from main branch and ran pnpm format. All formatting is now up to date.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build node s/.b�� sc -p ./tsconfig--llmstxt node de_modules/pnpm/dist/node-gyp-bin/node import @typespecnode tsconfig.build.j/home/REDACTED/work/typespec/typespec/packages/http-specs/node_modules�� n-schema/referengenerate-scenarios-summary sh tobu�� astro check --minimumFailingSeverity hint &amp;&amp; ast--filter node /.bin/sh lint-typespec-lish node tobuf/reference sh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

import { Badge${typekit.isExperimental ? ", Aside" : ""} } from '@astrojs/starlight/components';
`}
</>
{typekit.isExperimental && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still too complex and difficult to read. It should be possible to simplify the logic if the text of the pre-import and post-import documentation is conditional, instead of making large conditional code blocks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (commit 4717332). Simplified the logic by extracting conditional text to variables (registrationImport, typekitImport, sideEffectsExplanation). The code is now much easier to read with minimal conditional blocks and clearer intent.

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 9, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh k/ty�� ebsite/src/content/docs/docs/libraries/openapi/reference sh e . ture dist/node-gyp-bis,\\,/,g sh /nod�� tspd --enable-experimental gen-e--typekits dotnet .2_tmp_4092_0/node_modules/pnpm/dist/node-gyp-bin/sh r --no-emit l/reference k/typespec/typesdoc node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from markcowl March 9, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib:http meta:website TypeSpec.io updates tspd Issues for the tspd tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Http typekits are not exposed and documentation is missing info on how to use

4 participants